import { Object3D, Vector3 } from 'three';
import { SceneManager } from './SceneManager';

export const _SceneManager = new SceneManager();

export const OnLoad = 'onload';

export class HierarchyItem {
  id: string;
  label: string;
  children: HierarchyItem[];

  toHierarchy(node: Object3D, child: HierarchyItem[]) {
    node.children.forEach((n) => {
      const item: HierarchyItem = new HierarchyItem();
      item.id = n.uuid;
      item.label = n.name;
      item.children = [];
      child.push(item);
      this.toHierarchy(n, item.children);
    });
  }
}
_SceneManager.init(document.body);
_SceneManager.loadGLTFModelToScene('https://cc-sr.oss-cn-hangzhou.aliyuncs.com/static/indexModel/glTF/', "DamagedHelmet.gltf", new Vector3(-0.318, 0.428, 2.222));